<template>
  <div class="layout-container">
    <!-- 侧边栏 -->
    <el-aside width="240px" class="aside">
      <div class="logo">
        <h2>小微资产管理系统</h2>
      </div>
      <el-menu
        :default-active="activeMenu"
        class="el-menu-vertical"
        router
      >
        <el-menu-item index="/dashboard">
          <i class="el-icon-s-data"></i>
          <span>仪表盘</span>
        </el-menu-item>
        
        <el-sub-menu index="/statistics">
          <template #title>
            <i class="el-icon-chart"></i>
            <span>统计分析</span>
          </template>
          <el-menu-item index="/statistics/overview">资产概览</el-menu-item>
          <el-menu-item index="/statistics/status-distribution">状态分布</el-menu-item>
          <el-menu-item index="/statistics/category-distribution">分类分布</el-menu-item>
          <el-menu-item index="/statistics/dept-distribution">部门分布</el-menu-item>
          <el-menu-item index="/statistics/value-trend">价值趋势</el-menu-item>
          <el-menu-item index="/statistics/asset-ledger">资产台账</el-menu-item>
        </el-sub-menu>
        
        <el-sub-menu index="/check">
          <template #title>
            <i class="el-icon-document-check"></i>
            <span>资产盘点</span>
          </template>
          <el-menu-item index="/check/plan-list">盘点计划</el-menu-item>
          <el-menu-item index="/check/report">盘点记录报表</el-menu-item>
          <el-menu-item index="/check/statistics">盘点统计分析</el-menu-item>
          <el-menu-item index="/check/dept-statistics">部门盘点统计</el-menu-item>
          <el-menu-item index="/check/completion-trend">盘点完成率趋势</el-menu-item>
        </el-sub-menu>
      </el-menu>
    </el-aside>
    
    <!-- 主内容区 -->
    <el-container class="main-container">
      <!-- 顶部导航 -->
      <el-header height="60px" class="header">
        <div class="header-right">
          <el-dropdown>
            <span class="el-dropdown-link">
              <el-avatar size="small">管</el-avatar>
              <span style="margin-left: 8px;">管理员</span>
            </span>
            <template #dropdown>
              <el-dropdown-menu>
                <el-dropdown-item>个人中心</el-dropdown-item>
                <el-dropdown-item>退出登录</el-dropdown-item>
              </el-dropdown-menu>
            </template>
          </el-dropdown>
        </div>
      </el-header>
      
      <!-- 内容区域 -->
      <el-main>
        <router-view />
      </el-main>
    </el-container>
  </div>
</template>

<script>
export default {
  name: 'Layout',
  computed: {
    activeMenu() {
      const path = this.$route.path
      return path
    }
  }
}
</script>

<style scoped>
.layout-container {
  display: flex;
  height: 100vh;
}

.aside {
  background-color: #001529;
  height: 100%;
  overflow-y: auto;
}

.logo {
  height: 60px;
  line-height: 60px;
  text-align: center;
  color: white;
  font-size: 18px;
  border-bottom: 1px solid #1890ff;
}

.el-menu-vertical {
  background-color: #001529;
  border-right: none;
}

.el-menu-item,
.el-sub-menu__title {
  color: rgba(255, 255, 255, 0.65);
}

.el-menu-item:hover,
.el-sub-menu__title:hover {
  background-color: #1890ff;
  color: white;
}

.el-menu-item.is-active {
  background-color: #1890ff;
  color: white;
}

.main-container {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.header {
  background-color: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.header-right {
  display: flex;
  align-items: center;
}

.el-dropdown-link {
  display: flex;
  align-items: center;
  cursor: pointer;
}

.el-main {
  padding: 20px;
  overflow-y: auto;
}
</style>